<template>
	<view>
		<!-- 商品 -->
		<block v-if="type == 'goods'">
			<view class="m-bot20" v-for="(item,index) in list" :key="index" @click="toGoods(item.goods_id, item.store_id)">
				<image :src="item.img ? $imgUrls(item.img) : defaultUrl" mode="widthFix" lazy-load class="bor_radius_10"></image>
				<view class="padding10">
					<view class="size28 ellipsis_2 m-bot10">{{ item.name }}</view>
					<view class="color_99 m-bot10">
						<text class="m-right20" v-if="item.sales_number != 0">已售{{ item.sales_number }}</text>
						<text class="m-right20" v-if="item.show_number != 0">热度{{ item.show_number }}</text>
						<text v-if="item.commentNum != 0">评价{{ item.commentNum }}</text>
					</view>
					<view class="color_FOD m-bot10" v-if="item.buy_config.state == 1">
						￥<text class="size32 bold">{{ item.type == 2 ? item.open_group_price : item.price }}</text>
					</view>
					<view class="d-flex a-center" @click.stop="toUrl('/pages/store/storeIndex?shop_id=' + item.store_id)" v-if="item.storeInfo.store_id">
						<view class="flex-1 color_66 ellipsis">{{ item.storeInfo.name }}</view>
						<view class="m-left10">进店<text class="iconfont icon-xiangyouxiayiye h7"></text></view>
					</view>
				</view>
			</view>
		</block>
		<!-- 资讯 -->
		<block v-if="type == 'article'">
			<view class="m-bot20" v-for="(item,index) in list" :key="index" @click="$pop.artDetails(item)">
				<image :src="$imgUrls(item.website_article_img)" mode="widthFix" lazy-load class="bor_radius_10" v-if="item.website_article_img"></image>
				<image :src="$imgUrls(item.photoArr[0])" mode="widthFix" lazy-load class="bor_radius_10" v-else-if="item.photoArr"></image>
				<image :src="$imgUrls(item.poster)" mode="widthFix" lazy-load class="bor_radius_10" v-else-if="item.poster"></image>
				<image :src="$imgUrls(logo)" mode="widthFix" lazy-load class="bor_radius_10" v-else></image>
				<view class="padding10">
					<view class="size30 ellipsis_2 m-bot10">{{ item.website_article_title }}</view>
					<view class="color_66 ellipsis_2 m-bot10">{{ item.website_article_info }}</view>
					<view class="color_99 m-bot10">
						<text class="m-right20" v-if="item.website_article_views != 0">阅读{{ item.website_article_views }}</text>
						<text class="m-right20" v-if="item.allZan != 0">点赞{{ item.allZan }}</text>
						<text v-if="item.allComment != 0">评论{{ item.allComment }}</text>
					</view>
				</view>
			</view>
		</block>
	</view>
</template>

<script>
import { mapState } from 'vuex'
export default {
	props: {
		list: {
			type: Array,
			default: []
		},
		type: {
			type: String,
			default: 'goods'
		}
	},
	data() {
		return {
			defaultUrl: this.staticUrl + '/images/imageLoading.png'
		}
	},
	computed: {
        ...mapState(['logo'])
    },
	methods: {

	}
}
</script>

<style lang="scss" scoped>

</style>
